package org.finesys.system.convert;

import java.util.List;

import org.finesys.system.api.dto.ClientDetailsDto;
import org.finesys.system.api.entity.SysOauthClientDetails;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.ReportingPolicy;
import org.mapstruct.factory.Mappers;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

/**
 * MapStruct对象转换方法
 */
@Mapper(unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface SysOauthClientDetailsConvert {

    SysOauthClientDetailsConvert INSTANCE = Mappers.getMapper(SysOauthClientDetailsConvert.class);

    /**
     * 转换 ClientDetailsDto为SysOauthClientDetails对象
     */
    SysOauthClientDetails convert(ClientDetailsDto clientDetailsDto);

    /**
     * 转换 sysOauthClientDetails为  ClientDetailsDto对象
     */
    ClientDetailsDto convert(SysOauthClientDetails sysOauthClientDetails);

    /**
     * 数组转换
     */
    List<ClientDetailsDto> convert(List<SysOauthClientDetails> list);

    /**
     * 分页对象转换
     */
    @Mappings({
            @Mapping(target = "optimizeJoinOfCountSql", ignore = true)
    })
    Page<ClientDetailsDto> convert(Page<SysOauthClientDetails> page);
}
